package com.lxw.station.core;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

@Data
public class BasicEntity {
    @TableField(exist = false)
    private int pageNum;
    @TableField(exist = false)
    private int pageSize;
    @TableField(exist = false)
    private String sortInfo;

    public <T> IPage<T> parse() {
        if (StringUtils.hasText(sortInfo)) {
            return new Page<>(getPageNum(), getPageSize());
        }
        return new Page<>(getPageNum(), getPageSize());
    }
}
